package com.bawei.mvvmzonghe.dao;

import com.bawei.mvvmzonghe.App;
import com.bawei.mvvmzonghe.entity.GoodsEntity;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

/**
 * @Author : yaotianxue
 * @Time : On 2023/9/15 11:09
 * @Description : AppDataBase
 */
@Database(entities = {GoodsEntity.ListBean.class},version = 1,exportSchema = true)
public abstract class AppDataBase extends RoomDatabase {
    public static final String DB_NAME = "goods.db";

    private static AppDataBase appDataBase;
    public static AppDataBase getInstance(){
        if(appDataBase == null){
            synchronized (AppDataBase.class){
                if(appDataBase == null){
                    appDataBase = Room.databaseBuilder(App.instance,AppDataBase.class,DB_NAME)
                            .build();
                }
            }
        }
        return appDataBase;
    }

    private GoodsDao mGoodsDao;

    public abstract GoodsDao getGoodsDao();
}
